package net.huashitong.common.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.common.dao.WeekDocumentDao;
import net.huashitong.common.entity.WeekDocument;
import net.huashitong.common.filter.WeekDocumentFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/11/8
 * Time: 16:35
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
public class WeekDocumentService extends StringPKService<WeekDocument> {
    @Autowired
    private WeekDocumentDao weekDocumentDao;
    @Autowired
    private SysTableService tableService;

    @Override
    protected BaseDao<WeekDocument, String> getDao() {
        return weekDocumentDao;
    }

    @Override
    protected void beforeSave(WeekDocument obj) {
        obj.setSysId(tableService.updateMaxSysId("t_week_document", null));
    }

    public List<WeekDocument> queryFilter(WeekDocumentFilter filter) {
        return weekDocumentDao.queryFilter(filter);
    }
}
